package com.mtsmda.jpa.run;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;

import com.mtsmda.jpa.domain.onetooneUnidirectional.PersonAccount;
import com.mtsmda.jpa.domain.onetooneUnidirectional.PersonRegis;

public class OneToOneUniDirectionalServiceRun {

	public static void main(String[] args) {
		EntityManager entityManager = Persistence.createEntityManagerFactory(
				"MTSMDA").createEntityManager();
		entityManager.getTransaction().begin();

		PersonRegis personRegis = new PersonRegis("Igorev", "Igori");

		PersonAccount personAccount = new PersonAccount("igori", "igori12345");

		personRegis.setPersonAccount(personAccount);

		entityManager.persist(personRegis);

		entityManager.getTransaction().commit();
		entityManager.close();
	}

}